enum ViewState {
  //加载中
  loading,

  //暂无数据
  empty,

  //加载失败
  error,

  //成功
  success
}

enum ErrorType {
  //普通错判
  normal,

  //网络错误
  network
}

class ViewStateError {
  ErrorType errorType;
  String message;
  String errorMessage;

  ViewStateError(this.errorType, {this.message, this.errorMessage}) {
    errorType ??= ErrorType.normal;
    message ??= errorMessage;
  }

  bool get isNetWorkError => errorType == ErrorType.network;

  @override
  String toString() {
    return 'ViewStateError{errorType: $errorType, message: $message, errorMessage: $errorMessage}';
  }
}
